package com.windowes.weichang.service;

import com.windowes.weichang.common.ServerResponse;
import com.windowes.weichang.dao.DemandOperateLogMapper;
import com.windowes.weichang.pojo.DemandOperateLog;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/***
 *
 * @author: yangqing
 * @email: qing.yang@bangdao-tech.com
 * @createTime: 2018/7/1 下午10:40
 * @description:
 *
 **/
@Service
public class DemandLogService {


    @Autowired
    DemandOperateLogMapper demandOperateLogMapper;


    public ServerResponse listByDemandId(Integer demandId) {
        if (demandId == null) {
            return ServerResponse.createByErrorMessage("请提交demandId!");
        }
        List<DemandOperateLog> demandOperateLogs = demandOperateLogMapper.selectByDemandId(demandId);
        if (demandOperateLogs == null || demandOperateLogs.isEmpty()) {
            return ServerResponse.createByErrorMessage("未查询到操作记录!");
        }
        return ServerResponse.createBySuccess("获取成功!", demandOperateLogs);
    }
}
